#include "DFRobot_Relay.h"

DFRobot_Relay::DFRobot_Relay(int relay):_relay(relay)
{
  pinMode(_relay, OUTPUT);     //Set Pin3 as output  
}

void DFRobot_Relay::write(const char* onoff){
  if(!strcmp(onoff,"on")){
    digitalWrite(_relay, HIGH);   
    delay(1000);
  }
  if(!strcmp(onoff,"off")){
    digitalWrite(_relay, LOW);   
    delay(1000);
  }   
}

int DFRobot_Relay::read(){
  return digitalRead(_relay); 
}
